//
//  SLCreateAccessVC.m
//  SlockApp
//
//  Created by 凯朱 on 2024/7/25.
//

#import "SLCreateAccessVC.h"
#import "SLSelectAccessTypeVC.h"
@interface SLCreateAccessVC ()

@end

@implementation SLCreateAccessVC


- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUpSubViews];
}

-(void)setUpSubViews{
    self.title = kLocalString(@"Make new access");
    _nameLbl.text = _model.deviceName;
    _tipLbl.text = kLocalString(@"Make a new access for");
    
    _bgVIew.layer.cornerRadius = 20;
    _bgVIew.layer.masksToBounds = YES;
    
    _listLbl1.text = kLocalString(@"Fingerprint key");
    _listTipLbl1.text = kLocalString(@"Access with time duration limits.");
    _listLbl2.text = kLocalString(@"Bluetooth key");
    _listTipLbl2.text = kLocalString(@"Unlock with HEXFORCE app.");
    
    kWeakSelf(self);
    _listView1.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id  _Nonnull sender) {
        [weakself handleListAction:1];
    }];
    [_listView1 addGestureRecognizer:tap1];
    
    _listView2.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id  _Nonnull sender) {
        [weakself handleListAction:2];
    }];
    [_listView2 addGestureRecognizer:tap2];
    
}

-(void)handleListAction:(NSInteger)index{
    SLLockKeyModel *keyModel = [[SLLockKeyModel alloc] init];
    keyModel.lockType = index;
    SLSelectAccessTypeVC *vc = [[SLSelectAccessTypeVC alloc] init];
    vc.keyModel = keyModel;
    [self.navigationController pushViewController:vc animated:YES];
}


@end
